package com.renren.rrwx.view;

import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ListView;

import com.renren.rrwx.R;
import com.renren.rrwx.model.Hero;
import com.renren.rrwx.model.HeroManager;

/**
 * 用于显示我的属性的界面
 * 
 * @author Leon
 * 
 */
public class HeroListView extends FrameLayout {

	ListView lv;
	HeroManager hm;

	public HeroListView(Context context) {
		super(context);
		this.addView(View.inflate(context, R.layout.hero_list_view, null));
		lv = (ListView) findViewById(R.id.hero_list_view);
		lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub

			}
		});
		hm = HeroManager.getInstance(this.getContext());
		// 生成好友列表
		ArrayAdapter<Hero> adapter = new ArrayAdapter<Hero>(this.getContext(),
				android.R.layout.simple_list_item_1, hm.getHeros());
		lv.setStackFromBottom(true);
		lv.setAdapter(adapter);
	}
}
